package com.mengya.adapter;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gzcwt.entity.Notice;
import com.mengya.gzcwt.R;
public class NoticeTabListAdapter extends BaseAdapter{
	
	private Context con;
    private LayoutInflater inflater;
    private List<Notice> notices; 
	public NoticeTabListAdapter(Context con , List<Notice> notices){
		this.con = con;
		this.notices = notices;
		inflater=LayoutInflater.from(this.con);
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return notices.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView==null) {
            convertView=inflater.inflate(R.layout.notice_list_item, null);
        }
		TextView title = (TextView)convertView.findViewById(R.id.title);
		title.setText(notices.get(position).getTitle());
		TextView date = (TextView)convertView.findViewById(R.id.date);
		date.setText(notices.get(position).getPublicTime());
		TextView depart = (TextView)convertView.findViewById(R.id.depart);
		depart.setText(notices.get(position).getPublicDepart());
		TextView content = (TextView)convertView.findViewById(R.id.content);
		content.setText(notices.get(position).getContent());
		return convertView;
	}
}